package jetbrains.buildServer.cuta.logic.sheet;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;

/**
 * One sheet with properties.
 * @author Leonid Bushuev from JetBrains
 */
public class Table
{
    /**
     * Table column definitions.
     */
    public final List<Column> columns = new ArrayList<Column>(8);

    /**
     * Rows with their content.
     */
    public final List<Row> rows = new ArrayList<Row>(16);


    public List<Column> getColumns() { return columns;  }
    public List<Row> getRows() { return rows; }


    @Nullable
    public Column getColumnByName(final @NotNull String name)
    {
        for (int i = 0, n = columns.size(); i < n; i++)
            if (columns.get(i).getName().equalsIgnoreCase(name))
                return columns.get(i);
        return null;
    }
}
